#ifndef __SCRIPT_MANAGER_H__
#define __SCRIPT_MANAGER_H__

class Script;
//typedef boost::function< Int32(lua_State *) > LuaFunction;
class ScriptManager:public manager<Script,ScriptId>,public singleton<ScriptManager>
{
public:
	ScriptManager();
	virtual ~ScriptManager();
	virtual Script* Add(ScriptId id);
	virtual bool Remove(ScriptId id);
	virtual void Clear();
	Script* GetBattleScript(std::string strFileName,bool bReload = false);
	Script* GetPlayerScript(std::string strFileName,bool bReload = false);
	Script* GetItemScript(Int32 csv_id);
	Script* GetSkillScript(Int32 csv_id);
	Script* GetBuffScript(Int32 csv_id);
	void RegisterBattle(std::string strFunctionName, LuaFunction function);
	void RegisterPlayer(std::string strFunctionName, LuaFunction function);
private:
	void RegisterBattleToScript(Script* pScript);
	void RegisterPlayerToScript(Script* pScript);
private:
	std::map< std::string, Script* > m_mapNameScripts; 

	std::map< std::string, LuaFunction > m_mapBattleFunctions; 
	std::map< std::string, LuaFunction > m_mapPlayerFunctions;
};
#endif